import {
    reactive,
    effect,
    ref,
    toRefs,
    computed
} from './reactive.js'

// const product = reactive({
//     count: 1,
//     price: 20,
// })

// effect(() => {
//     let total = product.count * product.price
//     console.log(total)
// })
// product.count = 200
// product.price = 1

// const count = ref(10)
// const price = ref(200)
// effect(() => {
//     let total = count.value * price.value
//     console.log( count.value,price.value)
//     console.log(total)
// })
// count.value = 1

// const product = toRefs(reactive({
//     product: {
//         count: 1,
//         price: 20,
//     }
// }))
// const {
//     count,
//     price
// } = product

// effect(() => {
//     let total = count.value * price.value
//     console.log(total)
// })
// count.value = 200


const product = reactive({
    count: 1,
    price: 20,
})
let total = computed(() => {
    return product.count * product.price
})
console.log(total.value)
product.count = 200
console.log(total.value)
